package com.lk;

import com.lk.user.interceptor.LoginInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 启动类
 */
@SpringBootApplication
@MapperScan("com.lk.*.mapper")
@EnableCaching
public class CrmAppStart implements WebMvcConfigurer {
    public static void main(String[] args) {
        SpringApplication.run(CrmAppStart.class,args);
    }
    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                //拦截地址
                .addPathPatterns("/**")
                //放行地址
                .excludePathPatterns("/logininfo/**")
                .excludePathPatterns("/user/register/**")
                .excludePathPatterns("/user/register/**")
                .excludePathPatterns("/verifyCode/**")
                .excludePathPatterns("/fastdfs");
    }
}
